package cn.xiaopengstack.domain.strategy.service.rule.chain.impl;

import cn.xiaopengstack.domain.activity.repository.IRaffleActivityRepository;
import cn.xiaopengstack.domain.activity.service.IRaffleActivityQuotaService;
import cn.xiaopengstack.domain.strategy.repository.IStrategyRepository;
import cn.xiaopengstack.domain.strategy.service.armory.IStrategyDispatch;
import cn.xiaopengstack.domain.strategy.service.rule.chain.ILogicChain;
import cn.xiaopengstack.domain.strategy.service.rule.chain.factory.DefaultLogicChainFactory;
import lombok.extern.slf4j.Slf4j;

import javax.annotation.Resource;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author jiangyangang
 */
@Slf4j
public abstract class AbstractLogicChain implements ILogicChain {

    private ILogicChain next;

    @Resource
    protected IStrategyRepository strategyRepository;

    @Resource
    protected IStrategyDispatch strategyDispatch;

    @Resource
    protected IRaffleActivityQuotaService raffleActivityQuotaService;

    @Override
    public ILogicChain appendChain(ILogicChain nextChain) {
        this.next = nextChain;
        return next;
    }

    @Override
    public ILogicChain next() {
        return next;
    }

    /**
     * 设置规则名字
     * @return
     */
    protected abstract DefaultLogicChainFactory.LogicModel ruleModel();
}
